require(['jquery', 'cookie', 'app', 'lay', 'vue'], function ($) {
    layui.use(['element', 'layer'], function () {
        var layer = layui.layer;
        layer.load();
        testLogin();
        var x;
        x = setInterval(function () {
            if ($("#nav").html().length <= 35) {
                $("#nav").html($(".ready").html());
                layui.use('element', function () {
                    var element = layui.element;
                    element.init();
                    //xb_refer();
                });
            } else {
                clearInterval(x);
                xb_refer();
            }
        }, 0);
        require(['vue'], function (Vue) {
            var home = new Vue({
                el: '#admin',
                data: {
                    lists: "",
                    user: ""
                },
                created: function () {
                    this.user = JSON.parse(getCookie("user"));

                    var jon = {};
                    jon['roleCode'] = this.user['state'];
                    this.lists = JSON.parse(playAjax("1555508458586", JSON.stringify(jon)));
                    layui.use('element', function () {
                        var element = layui.element;
                        layer.closeAll('loading');
                       // xb_refer();
                    });
                    //xb_refer();
                }
            });
            layui.use('element', function () {
                var element = layui.element;
               // xb_refer();
            });
        });
    })
});

function view(code, name) {
    xadmin.add_tab(name, './vsp?code=' + code);
}

function loginOut() {
    setCookie("user", null);
    setCookie("token", null);
    window.location.href = "./vsp?code=1555508458588";
}
function showNav(e) {
    if($(e).next().css("display")=='none'){
        $(e).next().css("display","block");
    }else{
        $(e).next().css("display","none");
    }

}
